package com.ruoyi.merchant.controller;

import com.ruoyi.merchant.service.StoreService;
import com.ruoyi.merchant.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/store")
public class StoreController {

    @Autowired
    private StoreService storeService;

    @RequestMapping("/update")
    public Result storeUpdate(@RequestBody StoreUpdateRequest request) {
        System.err.println("地址：" + request.getAddress() + "，名称：" + request.getName() + "，uid：" + request.getUid());
        return storeService.storeUpdate(request.getAddress(), request.getName(), request.getUid());
    }

    // 将内部类改为静态内部类
    static class StoreUpdateRequest {
        private String address;
        private String name;
        private Integer uid;

        // Getter 和 Setter 方法
        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getUid() {
            return uid;
        }

        public void setUid(Integer uid) {
            this.uid = uid;
        }
    }
}
